package com.hmy.infrastructure.dal.dto;

import cn.hutool.core.bean.BeanUtil;
import com.hmy.infrastructure.api.bo.request.sms.SendVerificationCodeRequest;
import com.hmy.infrastructure.common.properties.SmsProperties;
import lombok.Data;

import java.io.Serializable;

/**
 * 发送验证码业务处理参数流转对象
 *
 * @author songkf
 */
@Data
public class SendVerificationCodeDTO implements Serializable {
    private static final long serialVersionUID = 4616991354739079650L;
    /**
     * 缓存Key
     */
    private String cacheCodeKey;

    /**
     * 业务Key
     */
    private String businessKey;
    /**
     * 接收手机号
     */
    private String phone;

    /**
     * 验证码配置
     */
    private SmsProperties.VerificationCode verificationCode;

    /**
     * 构建DTO
     *
     * @param sendRequest 请求参数
     * @return dto
     */
    public static SendVerificationCodeDTO buildDto(SendVerificationCodeRequest sendRequest) {
        return BeanUtil.copyProperties(sendRequest, SendVerificationCodeDTO.class);
    }
}
